<template>
	<view class="">
		<!-- 微信通用码 start-->
		<view v-show="diamond_wx_on" class="li-bg-f has-pdlr-20 has-mgb-3">
			<navigator url="./wxpay_list">
			<view class="has-floatl">
				<image src="../../static/img/common/wx_ico.png" mode=""></image>
				<text class="has-mgl-10">微信通用码</text>
			</view>
			<view class="has-floatr">
				<text class="is-blue has-mgr-10">{{ma_wx}}</text>
				<image src="../../static/img/common/right_ico_grey.png" mode=""></image>
			</view>
			</navigator>
		</view>
		<!-- 微信通用码 end-->
		<!-- 支付宝通用码 start-->
		<view v-show="diamond_zfb_on" class="li-bg-f has-pdlr-20 has-mgb-3">
			<navigator url="./alipay_list">
			<view class="has-floatl">
				<image src="../../static/img/common/zfb_ico.png" mode=""></image>
				<text class="has-mgl-10">支付宝通用码</text>
			</view>
			<view class="has-floatr">
				<text class="is-blue has-mgr-10">{{ma_alipay}}</text>
				<image src="../../static/img/common/right_ico_grey.png" mode=""></image>
			</view>
			</navigator>
		</view>
		<!-- 支付宝通用码 start-->
		<!-- QQ钱包通用码 start-->
		<view v-show="diamond_qq_on" class="li-bg-f has-pdlr-20 has-mgb-3">
			<navigator url="./qq_list">
			<view class="has-floatl">
				<image src="../../static/img/common/qq_ico.png" mode=""></image>
				<text class="has-mgl-10">QQ钱包通用码</text>
			</view>
			<view class="has-floatr">
				<text class="is-blue has-mgr-10">{{ma_qq}}</text>
				<image src="../../static/img/common/right_ico_grey.png" mode=""></image>
			</view>
			</navigator>
		</view>
		<!-- QQ钱包通用码 start-->
		<!-- 银联通用码 start-->
		<view v-show="diamond_bank_on" class="li-bg-f has-pdlr-20 has-mgb-3">
			<navigator url="./bank_list">
			<view class="has-floatl">
				<image src="../../static/img/common/bank_ico.png" mode=""></image>
				<text class="has-mgl-10">银联云闪付通用码</text>
			</view>
			<view class="has-floatr">
				<text class="is-blue has-mgr-10">{{ma_bank}}</text>
				<image src="../../static/img/common/right_ico_grey.png" mode=""></image>
			</view>
			</navigator>
		</view>
		<!-- 银联通用码 start-->
		<view>
		    <show-modal></show-modal>
		</view>
	</view>
</template>

<script>
	var _self;
	export default {
		data() {
			return {
				userinfo:[],
				fox_money_can:0,
				fox_user_jihuo:0,
				ma_lock:0,
				ma_wx:0,
				ma_alipay:0,
				ma_qq:0,
				ma_bank:0,
				diamond_zfb_on:0,
				diamond_wx_on:0,
				diamond_bank_on:0,
				diamond_qq_on:0
			}
		},
		onShow:function(e){
			let page = getCurrentPages().pop(); //跳转页面成功之后
			if (!page) return;
			this.get_info();
		},
		onLoad() {	
			this.get_info();
		},
		methods:{
			get_info(){
				_self = this;
				let info = this.service.getfox();
				if(info[0]){
					// console.log(info[0])				
					this.foxtoken = info[0]['foxtoken'];
					// uni.clearStorageSync();
					uni.request({
						url: this.service.FOX_URL + 'diamond/get_userinfo_ma',
						method:'POST',
						data: {
							user_key: this.foxtoken
						},
						dataType:'json',
						header:{
							'content-type':'application/x-www-form-urlencoded',
						},
						success: res => {
							// var rest = JSON.stringify(res);
							// console.log(res)
							var rest = res.data;
							if(rest.status == 'success'){
								this.userinfo = rest.msg;
								this.ma_lock = this.userinfo['ma_lock'];
								this.ma_wx = this.userinfo['ma']['wxma'];
								this.ma_alipay = this.userinfo['ma']['alima'];
								this.ma_qq = this.userinfo['ma']['qqma'];
								this.ma_bank = this.userinfo['ma']['bankma'];
								this.fox_money_can = this.userinfo['diamondset']['diamond_money_can'];
								this.fox_user_jihuo = this.userinfo['diamondset']['diamond_user_jihuo'];
								this.diamond_zfb_on = this.userinfo['diamondset']['diamond_zfb_on'];
								this.diamond_wx_on = this.userinfo['diamondset']['diamond_wx_on'];
								this.diamond_bank_on = this.userinfo['diamondset']['diamond_bank_on'];
								this.diamond_qq_on = this.userinfo['diamondset']['diamond_qq_on'];
								// console.log(this.userinfo)
							}else if(rest.status == 'error'){
								uni.clearStorageSync();
								uni.showToast({
									title:rest.msg,
									icon:'none',
									mask:true
								})
								setTimeout(function() {
								    uni.reLaunch({
								    	url:'../logon/login'
								    })
								}, 1500)
							}else{
								uni.clearStorageSync();
								uni.showToast({
									title:rest.msg,
									icon:'none',
									mask:true
								})
								setTimeout(function() {
								    uni.reLaunch({
								    	url:'../logon/login'
								    })
								}, 1500)
							}
						}
					})
				}else{
					uni.reLaunch({
						url:'../logon/login'
					})
				}
			}
		}
	}
</script>

<style>
	.li-bg-f{
		background: #FFFFFF;
		height: 120rpx;
		line-height: 120rpx;
	}
	.li-bg-f image{
		width:40rpx;
		height: 40rpx ;
		vertical-align: middle;
	}
</style>
